import {request} from '@umijs/max';
import * as API from "@/services";

/**
 * 获取当前登录用户信息
 * @param opts
 */
export async function queryCurrentUser(opts?: API.AxiosRequestOpts) {
    return request<API.RespResult<API.User>>('/api/v1/current-user', {
        ...(opts || {}),
    });
}

export async function modifyCurrentUser(entity: API.User_Modify): Promise<API.RespResult<any>> {
  return request(`/api/v1/user/current`, {
    method: 'PUT',
    data: entity,
  });
}

export async function patchCurrentUser(entity: API.User_Modify): Promise<API.RespResult<any>> {
  return request(`/api/v1/user/current`, {
    method: 'PUT',
    data: entity,
  });
}

